Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(webserver): Implement file search and meta query #1731

Closed
wants to merge 5 commits into from

Conversation

boxbeam
Copy link
Contributor

@boxbeam boxbeam commented Mar 26, 2024

Fixes TAB-547
cc @liangfung

@boxbeam boxbeam requested a review from wsxiaoys March 26, 2024 20:50
Copy link

codecov bot commented Mar 26, 2024

Codecov Report

Attention: Patch coverage is 18.80342% with 95 lines in your changes are missing coverage. Please review.

Project coverage is 52.90%. Comparing base (8dc0548) to head (6e706d7).
Report is 9 commits behind head on main.

Files Patch % Lines
ee/tabby-webserver/src/schema/repository.rs 0.00% 48 Missing ⚠️
ee/tabby-webserver/src/service/repository.rs 13.20% 46 Missing ⚠️
crates/tabby-common/src/lib.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1731      +/-   ##
==========================================
- Coverage   53.68%   52.90%   -0.78%     
==========================================
  Files         115      115              
  Lines        9716     9897     +181     
==========================================
+ Hits         5216     5236      +20     
- Misses       4500     4661     +161     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

ee/tabby-webserver/src/schema/mod.rs Outdated Show resolved Hide resolved
ee/tabby-webserver/src/service/repository.rs Outdated Show resolved Hide resolved
ee/tabby-webserver/src/service/repository.rs Outdated Show resolved Hide resolved
@wsxiaoys wsxiaoys marked this pull request as draft March 26, 2024 23:16
@wsxiaoys
Copy link
Member

Consider add #[deprecated] to

@boxbeam boxbeam marked this pull request as ready for review March 27, 2024 18:46
fn match_glob(path: &str, glob: &str) -> bool {
let glob = glob.to_lowercase();
let mut path = &*path.to_lowercase();
// Current behavior: Find each "word" (any substring separated by whitespace) appearing in the same order
Copy link
Contributor Author

@boxbeam boxbeam Mar 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wsxiaoys Tried using ignore but couldn't get it behaving as I wanted, so I switched to async_walkdir with my own glob filter instead. This comment explains its behavior, and I can show some screenshots to demonstrate how it works:
image
image
image
image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@wsxiaoys wsxiaoys Mar 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why it cannot be using ignore - since you're implementing your own glob match anyway.

Copy link
Contributor Author

@boxbeam boxbeam Mar 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. ignore does not allow for custom globs for matching, only ignoring files as far as I can tell
  2. ignore is not async, and so would block the entire server's async runtime while it is running a search
  3. there is an option for parallel walking with ignore, but the crate as a whole does not seem better-suited to our task than async-walkdir - async makes more sense than parallel here, and ignore doesn't provide the globbing we want anyways

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. As said - glob is implemented as customized filter anyway
  2. tokio manage its requests in multi threads async runtime. Thus won’t block

ee/tabby-db/schema.sqlite Outdated Show resolved Hide resolved
@wsxiaoys wsxiaoys marked this pull request as draft March 29, 2024 05:51
@boxbeam boxbeam marked this pull request as ready for review March 29, 2024 17:53
@wsxiaoys wsxiaoys marked this pull request as draft March 29, 2024 23:47
@boxbeam boxbeam closed this Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants